package com.ruoyi.wxauthentication.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.wxauthentication.mapper.StudentInfoMapper;
import com.ruoyi.wxauthentication.pojo.StudentInfo;
import com.ruoyi.wxauthentication.service.IStudentInfoService;
import com.ruoyi.wxcommon.common.Result;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 凡哥哥
 * @since 2024-05-27
 */
@Service
public class StudentInfoServiceImpl extends ServiceImpl<StudentInfoMapper, StudentInfo> implements IStudentInfoService {
    /**
     * 认证匹配
     * @param studentNumber
     * @param identificationNumber
     * @return
     */
    @Override
    public Result<StudentInfo> authentication(Long studentNumber, String identificationNumber) {
        QueryWrapper<StudentInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("identification_number",identificationNumber);
        queryWrapper.eq("student_number",studentNumber);
        return Result.SUCCESS(this.baseMapper.selectOne(queryWrapper));
    }

    @Override
    public Result userAuthentication(Long studentNumber) {
        QueryWrapper<StudentInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("student_number",studentNumber);
        return Result.SUCCESS(this.baseMapper.selectOne(queryWrapper));
    }

}
